import config from "./config.js"
export const https = (options) => {
	return new Promise((resolve, reject) => {
		// console.log(config.host+options.url,"oji")
		let accessToken = uni.getStorageSync('accessToken') || '';
		uni.request({
			url: config.host + options.url,

			method: options.method || 'GET',
			header: {
				token: accessToken
				// uni.getStorageSync('accessToken')?uni.getStorageSync('accessToken'):''
			},
			data: options.data || {},
			success: (res) => {
				resolve(res.data)
			},
			fail: (err) => {
				reject(err)
			}
		})
	})
}

export const song = (options) => {
	return new Promise((resolve, reject) => {
		// console.log(config.host+options.url,"oji")
		let accessToken = uni.getStorageSync('accessToken') || '';
		uni.request({
			url: config.song + options.url,

			method: options.method || 'GET',
			header: {
				token: accessToken
				// uni.getStorageSync('accessToken')?uni.getStorageSync('accessToken'):''
			},
			data: options.data || {},
			success: (res) => {
				resolve(res.data)
			},
			fail: (err) => {
				reject(err)
			}
		})
	})
}